Hello,
I'm driving myself crazy trying to understand some weird behavior with a SELECT using ILIKE. I'm
using a prepared statement:
String sql = "SELECT * FROM business WHERE name ILIKE ? ORDER BY name;";
PreparedStatement stmt = conn.prepareStatement(sql);
String s = "%" + query + "%";
stmt.setString(1, s);
I have a business with name: "PETCO - Beaverton" (this has been confirmed numerous times!)
When the variable query = "petco", it doesn't match. When query is "p", "pe", "pet", "etc" it matches
fine. It also doesn't match when query is "petc" or "tco". Case doesn't seem to have an effect.
Running from psql matches all of the above, but when used with the java/jdbc code above, it fails in
the above few cases (and the most important one - "petco"!). I've confirmed using print statements
that query contains the "correct" string immediately before the String s = line.
Any ideas? I can't seem to find any more examples of this weird behaviour with other business
names...
Thanks,
Keith K.